import httpRequest from "@/utils/request";
import { UserInfo } from "@/store/modules/user";

const AuthAPI = {
  /**
   * 登录接口
   *
   * @param username 用户名
   * @param password 密码
   * @returns 返回 token
   */
  login(username: string, password: string): Promise<ResponseData> {
    return httpRequest<ResponseData>({
      url: "/atcp-auth/login",
      method: "POST",
      data: {
        username,
        password,
      },
      header: {
        "Content-Type": "application/json",
      },
    });
  },

  /**
   * 登出接口
   */
  logout(refreshToken: String): Promise<ResponseData> {
    return httpRequest({
      url: "/atcp-auth/logout",
      method: "GET",
      data: { refreshToken },
    });
  },
};

export default AuthAPI;

